package com.zdkj.common.core.entity;

import com.alibaba.excel.annotation.ExcelIgnore;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import java.time.LocalDateTime;
import java.util.List;

/**
 * @support: 三永华通科技有限公司
 * @author: cui_com
 * @version: 1.0
 * @Date: 2020-09-18 18:27
 * @Description: <p>
 *
 * </p>
 */
@Data
public class BaseEntity<T extends BaseEntity<?>> extends Model<T> {

    /**
     * 部门id
     */
    @TableField(value = "DEPT_ID", fill = FieldFill.INSERT)
    @ApiModelProperty(value = "部门id")
    @ExcelIgnore
    private Integer deptId;
    /**
     * 创建人ID
     */
    @TableField(value = "CREATOR_ID", fill = FieldFill.INSERT)
    @ApiModelProperty(value = "创建人ID")
    @ExcelIgnore
    private Integer creatorId;
    /**
     * 创建人名称
     */
    @TableField(value = "CREATOR_NAME", fill = FieldFill.INSERT)
    @ApiModelProperty(value = "创建人名称")
    @ExcelIgnore
    private String creatorName;
    /**
     * 创建时间
     */
    @TableField(value = "CREATE_TIME", fill = FieldFill.INSERT)
    @ApiModelProperty(value = "创建时间")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss")
    @ExcelIgnore
    private LocalDateTime createTime;
    /**
     * 更新时间
     */
    @ApiModelProperty(value = "更新时间")
    @TableField(value = "UPDATE_TIME", fill = FieldFill.INSERT_UPDATE)
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss")
    @ExcelIgnore
    private LocalDateTime updateTime;
    /**
     * 删除标志：1 删除  0未删除
     */
    @TableLogic
    @JsonIgnore
    @ApiModelProperty(value = "删除标志：1 删除  0未删除")
    @ExcelIgnore
    private String delFlag;

    /**
     * 用于前端传开始结束日期
     */
    @TableField(exist = false)
    @ExcelIgnore
    private List<String> dates1;

    @TableField(exist = false)
    @ExcelIgnore
    private List<String> dates2;

    @TableField(exist = false)
    @ExcelIgnore
    private List<String> dates3;

    @TableField(exist = false)
    @ExcelIgnore
    private List<String> dates4;
}
